package com.wolfman.uploadfile.po;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Title
 * @Description
 * @Author WolfMan
 * @Date 2021/8/23 13:45
 * @Email 2370032534@qq.com
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileUpload {

    /**
     * 文件id
     */
    private Integer id;
    /**
     * 文件名
     */
    private String filename;
    /**
     * 文件路径
     */
    private String filePath;
    /**
     * 文件上传进度，100表示上传完成
     */
    private Double uploadProgress;

    /**
     * 格式化返回进度
     *
     * @return
     */
    public Double getUploadProgress() {
        if (uploadProgress == null) {
            uploadProgress = 0D;
        }
        return Double.valueOf(String.format("%.2f", uploadProgress));
    }

}
